import React from 'react';
import {BrowserRouter as Router, Link} from 'react-router-dom';//导入的方式跟之前有点变化

import { Form, Icon, Input, Button, Checkbox } from 'antd';
const FormItem = Form.Item;

class NormalLoginForm extends React.Component {
    handleSubmit = (e) => {
        e.preventDefault();
        this.props.form.validateFields((err, values) => {
            if (!err) {
                console.log('Received values of form: ', values);
            }
        });
    };
    login = () => {
        console.log('123344');
        this.props.history.push('/Entrance/WorkerInformation');
    };
    render() {
        const { getFieldDecorator } = this.props.form;
        return (
            <Router>
                <div id="components-form-demo-normal-login">
                    <Form onSubmit={this.handleSubmit} className="login-form">
                        <h1 className="login-h1">人员管理后台</h1>
                        <p className="login-p">四川叁伍捌建设工程有限公司</p>
                        <FormItem>
                            {getFieldDecorator('userName', {
                                rules: [{ required: true, message: '请输入你的账号！' }],
                            })(
                                <Input prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="账号" />
                            )}
                        </FormItem>
                        <FormItem>
                            {getFieldDecorator('password', {
                                rules: [{ required: true, message: '请输入你的密码！' }],
                            })(
                                <Input prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} type="password" placeholder="密码" />
                            )}
                        </FormItem>
                        <FormItem>
                            <Button
                                type="primary"
                                htmlType="submit"
                                className="login-form-button"
                                onClick={this.login}
                            >
                                登陆
                            </Button>
                        </FormItem>
                    </Form>
                </div>
            </Router>
        );
    }
}

const Login = Form.create()(NormalLoginForm);

export default Login;